import unittest

from google.appengine.api import memcache
from google.appengine.ext import ndb
from google.appengine.ext import testbed

from player import *
from server_main import *
from edit_user_forms import *

json_string = '''{"name": "Player1", "words": ["word1", "word2", "word3", "word4"]}'''



class PAPFSTest(unittest.TestCase):
    def setUP(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()

    def test_creation(self):
        player = Player(email = 'email', 
                            nickname = 'Player1',
                            pin_code = 0000,
                            words = ['word1', 
                                    'word2', 
                                    'word3', 
                                    'word4']
                            )
        adding_player = ProcessAddingPlayerFromServer()
        self.player_json = adding_player.player_to_json(player.nickname, player.words)
        self.assertEqual(self.player_json, json_string)
        
if __name__ == '__main__':
    unittest.main()